$(document).ready(function() {
	getMyCommented(0,0);
	}
		);

function getMyCommented(index,pagecount){
	x = getCookie("user");
	if (x == "") {
		exitsys();
		showLoginWin();
		loginwarn("您尚未登录，请先登录，谢谢！");
		return;
	}
	$.ajax({
		type : "post",
		dataType : "json",
		url : "GetCommented",
		data : "index="+index+"&pagecount="+pagecount,
		success : function(rsp) {
			showCommented(rsp);
		}
	});
}

function showCommented(rsp){
	if(rsp["msg"]!=null){
		msg=rsp["msg"];
		if(rsp["msg"]=="-1"){
			msg="您尚未登录，请登录后再继续操作，谢谢！";
			exitsys();
			showLoginWin();
			loginwarn("您尚未登录，请先登录，谢谢！");
		}
		return;
	}
	$("#middle").html("");
	content="<table class='tstl'>";	
	for(var i=0;i<rsp.res.length;i++){
		tmp=rsp.res[i].comment;
		if (tmp.length>40){
			tmp+="......";
		}	
		if (rsp.res[i].type=="0"){
		content+="<tr class='tstl_tr'><td width='180px'><a  target='_blank' href=jsp/item.jsp?itemid=" + rsp.res[i].item
					+ "><img class='itemimg' src=" + rsp.res[i].itemimg + " /></a></td>" 							
					+ "<td><div class='textc'>在<span class='blue'>"+rsp.res[i].ctime+"</span><br>评价<a target='_blank' href=jsp/item.jsp?itemid=" + rsp.res[i].item+">"
					+ "<span class='blue'>" + rsp.res[i].itemname + "</span></a><br>" 
					+ "<a target='_blank' href=jsp/item.jsp?itemid=" + rsp.res[i].item
					+  "><span class='gray'>"+tmp+"</span></a></div></td>" +
							"</tr>";
		}
		else if (rsp.res[i].type!="0"){
			content+="<tr class='tstl_tr'><td  width='180px'><a target='_blank' href=jsp/item.jsp?itemid=" + rsp.res[i].item
					+ "><img class='itemimg' src=" + rsp.res[i].itemimg + " /></a></td>" +
							"<td><div class='textc'>在<span class='blue'>"+rsp.res[i].ctime+"</span><br>投票赞成了对<a target='_blank' href=jsp/item.jsp?itemid=" + rsp.res[i].item
					+ "><span class='blue'>" + rsp.res[i].itemname + "</span></a>的评价<br>" +
							"<a target='_blank' href=jsp/item.jsp?itemid=" + rsp.res[i].item
					+  "><span class='gray'>"+tmp+"</span></a></div></td>" +
							"</td></tr>";
		}
	}
	
	content+="</table>";
	if (rsp.res.length==0){
		content="尚未对任何人作出过评价！";
	}
	var pc=parseInt(rsp.pagecount);
	var tmp="";
	if(pc>0){
		tmp+="第";
		for(var i=1;i<=(pc+1);i++){
			if(i % 20==0){
				tmp+="<br/>";
			}
			tmp+="<a  href='javascript:getMyCommented("+(i-1)+","+pc+")'>"+i+" </a>";
			
		}
		tmp+="页";
	}
	content+=tmp;
	$("#middle").append(content);
	
	window.location.hash="pagetop";
	var len=rsp.res.length*130;
	if (len<800){
		len=800;
	}
	$("#middle").css({
		"height" : len + "px"
	});
}
